//package com.changjiang.myproductsale.myproduct.servlet;
//
//import com.changjiang.myproductsale.myproduct.dao.impl.ProductImpl;
//import com.changjiang.myproductsale.myproduct.entity.Product;
//
//import javax.servlet.*;
//import javax.servlet.http.*;
//import javax.servlet.annotation.*;
//import java.io.IOException;
//import java.util.List;
//
//@WebServlet(name = "ServletHot", value = "/hot")
//public class ServletHot extends HttpServlet {
//    @Override
//    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        this.doPost(request, response);
//    }
//
//    @Override
//    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        try {
//            // 调用后端代码
//            ProductImpl productDao = new ProductImpl();
//            // 获取热销10本
//            List<Product> HotProducts = productDao.getHotProducts();
//
//            // 将商品信息设置为请求属性
//            request.setAttribute("HotProducts", HotProducts);
//            // 转发请求到index.jsp页面
//            request.getRequestDispatcher("/index.jsp").forward(request, response);
//        } catch (Exception ex) {
//            ex.printStackTrace();
//            response.sendRedirect("500.html");
//        }
//    }
//}